﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace bai5thuchanh2
{
    class nguoi
    {
        string hoten;
        DateTime namsinh;
        float chieucao;
        float cannang;
        public string HoTen
        {
            get { return hoten; }
            set { hoten = value; }
        }
        public DateTime NamSinh
        {
            get { return namsinh;}
            set {namsinh=value;}
        }
        public float ChieuCao
        { 
            get {return chieucao;}
            set
            {
                if (chieucao < 1.2 || chieucao > 1.8)
                {
                    Console.WriteLine(" ban hay nhap lai cheu cao:");
                }
                else
                    chieucao = value;
              }
          }
        public float CanNang
        {
            get { return cannang; }
            set
            {
                if (cannang < 20 || cannang > 200)
                {
                    Console.WriteLine("ban vui long nhap lai can nang:");
                }
                else
                    cannang = value;
                }
           }
        public virtual void nhap()
        {
            Console.Write("nhap ho ten cua nguoi:");
            HoTen=Console.ReadLine();
            Console.Write(" nhap chieu cao cua nguoi:");
            ChieuCao=float.Parse(Console.ReadLine());
            Console.Write("nhap can nang cho nguoi:");
            CanNang=float.Parse(Console.ReadLine());
        }
        public int suckhoe(float CanNang, float ChieuCao)
        {
            float k = CanNang / ChieuCao * ChieuCao;
            int i = 0;
            if (k > 20 && k < 30)
            {
                i = 0;
            }
            else if (k < 20)
            {
                i = -1;
            }
            else if (k > 30)
            {
                i = 1;
            }
            return i;
        }
        public void xuat()
        {
            Console.WriteLine(" hoten:{0},namsinh:{1},cannang:{2},chieucao:{3}", HoTen, NamSinh, CanNang, ChieuCao);
        }
        /// <summary>
        /// /
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public float CongChieuCao(nguoi a,nguoi b)
        {
         float kq=0;
            kq=a.ChieuCao+b.ChieuCao;
            return kq;
        }
        public float CongCanNang(nguoi a, nguoi b)
        {
            float kq = 0;
            kq = a.CanNang + b.CanNang;
            return kq;
        }





    }
}
